﻿using Cms.Core.Application.Service.PermissionInfo;
using Cms.Core.Application.Service.PermissionInfo.Dto;
using Cms.Core.Data.Model;
using Cms.Core.Infrastructure.Dependency;
using Cms.Core.Infrastructure.Ui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cms.Core.Application.IService.PermissionInfo
{
    /// <summary>
    /// 权限接口
    /// </summary>
   public interface IPermissionService : ITransientDependency
    {

        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="input"></param>
        /// <param name="checkPermissionFunc"></param>
        /// <returns></returns>
         Task<OperationResult> AddPermissionAsync(PermissionDto input, Func<string, string, Guid, Task> checkPermissionFunc);

        /// <summary>
        /// 异步更新或者更新权限
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
         Task<OperationResult> UpdateOrAddPermissionAsync(PermissionDto input);

        /// <summary>
        /// 更新权限异步
        /// </summary>
        /// <param name="input"></param>
        /// <param name="checkPermissionFunc"></param>
        /// <returns></returns>
        Task<OperationResult> UpdatePermissionAsync(PermissionDto input, Func<string, string, Guid, Task> checkPermissionFunc);

        /// <summary>
        /// 得到权限分页信息
        /// </summary>
        /// <param name="pageRequestData">分页请求数据</param>
        /// <returns></returns>

        Task<PageResult> GetPermissionPageDataAsync(PageRequestData pageRequestData);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pageRequestData"></param>
        /// <returns></returns>
        Task<PageResult<PermissionTreeItem>> GetPermissionListAsync(PageRequestData pageRequestData);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        Task<OperationResult> GetPermissionTreeCascaderItemAsync();

        /// <summary>
        /// 异步加载权限表单信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<OperationResult<PermissionDto>> LoadPermissionFormAsync(Guid? id);


        /// <summary>
        ///异步软删除 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        Task<OperationResult> SoftDeletePermissionAsync(Guid id);

        /// <summary>
        /// 根据角色Id集合得到权限
        /// </summary>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        IQueryable<SysPermission> GetPermissionsByRoleIds(IEnumerable<Guid> roleIds);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        Task<IEnumerable<dynamic>> GetCurrentUserAuthorizationAllButtonByParentNameAsync(string name);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<IEnumerable<PermissionItemDto>> GetUserAuthorizationUrl(Guid userId);

        /// <summary>
        /// 得到菜单
        /// </summary>
        /// <returns></returns>
        Task<OperationResult<List<MenuDto>>> GetAllMenusAsync();


    }
}
